<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul id="list">
        <li>li1</li>
        <li>li2</li>
        <li id="li3">li3</li>
        <li>li4</li>
    </ul>
    <script>
        const list = document.getElementById('list');
        const newLI = document.createElement('li');
        const newP = document.createElement('p');
        newLI.innerHTML = 'new LI';
        newP.innerHTML = 'new P';
        // list.append(newLI);
        // list.prepend(newLI);
        // list.after(newP);
        list.before(newP);

    </script>
</body>

</html>